<?php
class base extends Action{
	protected $_G = array();

	/**
	 * 对数据进行处理
	 *
	 */
	protected function init(){
		if (isset($_GET)) $_GET = $this->_htmlspecialchars($_GET);
		if (isset($_POST)) $_POST = $this->_htmlspecialchars($_POST);
		if (isset($_REQUEST)) $_REQUEST = $this->_htmlspecialchars($_REQUEST);
		if (isset($_COOKIE)) $_COOKIE = $this->_htmlspecialchars($_COOKIE);
	}

	public function __construct(){
		

	}

	
	/**
	 * 采用htmlspecialchars反转义特殊字符
	 *
	 * @param array|string $data 待反转义的数据
	 * @return array|string 反转义之后的数据
	 */
	protected function _htmlspecialchars(&$data) {
		return is_array($data) ? array_map(array($this, '_htmlspecialchars'), $data) : trim ( htmlspecialchars ( $data ) );
	}

	/**
	 * 判断是否为ajax传值
	 *
	 * @return unknown
	 */
	protected function isajax()
	{
		if (isset ( $_SERVER ['HTTP_X_REQUESTED_WITH'] ) && strtolower ( $_SERVER ['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest') {
			return true;
		} else {
			return false;
		}
	}

	
}